<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<!DOCTYPE HTML>
<html>
	<head>
		<title>菜单列表 - 用户中心</title>
		<%@ include file="/common/include/title.jsp"%>
		<link
			href="${rootPath }/common/resource/H-ui.admin/static/h-ui.admin/css/H-ui.login.css"
			rel="stylesheet" type="text/css" />
		<meta name="keywords" content="用户中心-登录">
		<meta name="description" content="用户中心-登录">
		</head>
	<body>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页
			<span class="c-gray en">&gt;</span>权限模块 
			<span class="c-gray en">&gt;</span> 菜单列表 
			<a class="btn btn-success radius r" style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新">
				<i class="Hui-iconfont">&#xe68f;</i>
			</a>
		</nav>
		<div class="page-container">
			<form action="${rootPath }/back/UsersBack/menuList" method="post">
				<div class="text-c">
					<input type="text" name="keyword" id="" value="${requestScope.keyword }" placeholder="请输入关键字"
						style="width: 250px" class="input-text">
					<span class="select-box inline">
						状态:
						<select name="status" class="select">
							<option value="">请选择</option>
							<option value="1" ${requestScope.status == '1' ? 'selected' : '' }>启用</option>
							<option value="0" ${requestScope.status == '0' ? 'selected' : '' }>禁用</option>
						</select>
					</span>
					日期范围：
					<input type="text" readonly="readonly" value="${requestScope.stDate }"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
						name="stDate" class="input-text Wdate" style="width: 170px;">
					- <input type="text" readonly="readonly"  value="${requestScope.edDate }"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
						name="edDate" class="input-text Wdate" style="width: 170px;">
					<button name="" id="" class="btn btn-success" type="submit">
						<i class="Hui-iconfont">&#xe665;</i> 搜索
					</button>
				</div>
			</form>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
					<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius">
						<i class="Hui-iconfont">&#xe6e2;</i> 批量删除
					</a>
					<a class="btn btn-primary radius" data-title="添加菜单" 
						data-href="${rootPath }/back/UsersBack/menuInsert&parentId=0" onclick="Hui_admin_tab(this)"
						href="javascript:;">
						<i class="Hui-iconfont">&#xe600;</i> 添加菜单
					</a>
					<a class="btn btn-primary radius" data-title="菜单列表_树形结构" 
						data-href="${rootPath }/back/UsersBack/menuTreeList" onclick="Hui_admin_tab(this)"
						href="javascript:;">
						<i class="Hui-iconfont">&#xe600;</i> 菜单列表_树形结构
					</a>
				</span>
				<span
					class="r">共有数据：<strong>${requestScope.pageInfoUtil.totalRecord }</strong> 条
				</span>
			</div>
			<div class="mt-20">
				<div id="DataTables_Table_0_wrapper"
					class="dataTables_wrapper no-footer">
					<form id="formId" method="post" action="${rootPath }/back/UsersBack/menuBatch" onsubmit="return vailForm('formId','ids')">
						<span class="select-box inline">
							状态:
							<select name="status" class="select">
								<option value="1" ${requestScope.status == '1' ? 'selected' : '' }>启用</option>
								<option value="0" ${requestScope.status == '0' ? 'selected' : '' }>禁用</option>
							</select>
						</span>
						<button name="" id="" class="btn btn-success" type="submit">
							批量操作
						</button>
						<table
							class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
							<thead>
								<tr class="text-c">
									<th width="25"><input type="checkbox" name="selectAll" id="selectAllId" onclick="return checkAllSelect('selectAllId','ids')"></th>
									<th width="30">Id</th>
									<th width="80">上一级</th>
									<th width="90">名称</th>
									<th width="80">级别</th>
									<th width="80">状态</th>
									<th width="80">叶子节点</th>
									<th width="80">创建人</th>
									<th width="80">更新人</th>
									<th width="120">更新时间</th>
									<th width="120">发布时间</th>
									<th width="80">操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${requestScope.menuList }" var="oneTemp" varStatus="stat">
									<tr class="text-c">
										<td><input type="checkbox" value="${oneTemp.id }" name="ids"></td>
										<td>${oneTemp.id }</td>
										<td>${oneTemp.parentMenu.name }</td>
										<td class="text-l">
											<u style="cursor: pointer" class="text-primary"
												onClick="article_edit('菜单查看','${rootPath }/back/UsersBack/menuUpdate?id=${oneTemp.id }','10001')"
												title="查看">
												${oneTemp.name }
											</u>
										</td>
										<td>${oneTemp.levels }</td>
										<td class="td-status">
											<span class="label label-success radius">
												<c:choose>
													<c:when test="${oneTemp.status == '1' }">
														启用
													</c:when>
													<c:when test="${oneTemp.status == '0' }">
														禁用
													</c:when>
													<c:otherwise>
														未知
													</c:otherwise>
												</c:choose>
											</span>
										</td>
										<td class="td-status">
											<span class="label label-success radius">
												<c:choose>
													<c:when test="${oneTemp.leafStatus == '1' }">
														启用
													</c:when>
													<c:when test="${oneTemp.leafStatus == '0' }">
														禁用
													</c:when>
													<c:otherwise>
														未知
													</c:otherwise>
												</c:choose>
											</span>
										</td>
										<td>
											<u style="cursor: pointer" class="text-primary"
												onClick="article_edit('管理员查看','${rootPath }/back/UsersBack/adminsUpdate?id=${oneTemp.creater}','10001')"
												title="查看">
												${oneTemp.createrAdmins.nickName }
											</u>
										</td>
										<td>
											<u style="cursor: pointer" class="text-primary"
												onClick="article_edit('管理员查看','${rootPath }/back/UsersBack/adminsUpdate?id=${oneTemp.updater }','10001')"
												title="查看">
												${oneTemp.updaterAdmins.nickName }
											</u>
										</td>
										<td><fmt:formatDate value="${oneTemp.updateTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
										<td><fmt:formatDate value="${oneTemp.pubTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
										<td class="f-14 td-manage">
											<a style="text-decoration: none" class="ml-5" data-title="菜单更新" title="菜单更新" 
												onclick="return article_edit('菜单更新','${rootPath }/back/UsersBack/menuUpdate&operType=updateInfo&id=${oneTemp.id }',500,500)"
												href="javascript:;">
												<i class="Hui-iconfont">&#xe6df;</i>
											</a>
											<a style="text-decoration: none" class="ml-5" data-title="添加子菜单" title="添加子菜单" 
												data-href="${rootPath }/back/UsersBack/menuInsert&parentId=${oneTemp.id }" 
												onclick="Hui_admin_tab(this)"
												href="javascript:;">
												<i class="Hui-iconfont">&#xe600;</i>
											</a>
											<a style="text-decoration: none" class="ml-5" onClick="article_del(this,'10001')" href="javascript:;"
												title="删除"><i class="Hui-iconfont">&#xe6e2;</i>
											</a>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</form>
					<form id="pageForm" action="${rootPath }/back/UsersBack/menuList" method="post">
						<input type="hidden" name="keyword" value="${requestScope.keyword}">
						<input type="hidden" name="status" value="${requestScope.status}">
						<input type="hidden" name="roleId" value="${requestScope.roleId}">
						<input type="hidden" name="stDate" value="${requestScope.stDate}">
						<input type="hidden" name="edDate" value="${requestScope.edDate}">
						<div class="dataTables_info" id="DataTables_Table_0_info"
							role="status" aria-live="polite">共${requestScope.pageInfoUtil.totalPage}页，共${requestScope.pageInfoUtil.totalRecord }条</div>
						<div class="dataTables_paginate paging_full_numbers"
							id="DataTables_Table_0_paginate">
							<a class="paginate_button first disabled"
								aria-controls="DataTables_Table_0" data-dt-idx="0" tabindex="0"
								onclick="return pageFormSubmit('pageForm','currentPage','1','pageSize','${requestScope.pageInfoUtil.pageSize}')"
								id="DataTables_Table_0_first">首页</a>
							<a class="paginate_button previous disabled"
								aria-controls="DataTables_Table_0" data-dt-idx="1" tabindex="0"
								onclick="return pageFormSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.prePage}','pageSize','${requestScope.pageInfoUtil.pageSize}')"
								id="DataTables_Table_0_previous">上一页</a>
							<a class="paginate_button next" aria-controls="DataTables_Table_0"
								onclick="return pageFormSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.nextPage}','pageSize','${requestScope.pageInfoUtil.pageSize}')"
								data-dt-idx="4" tabindex="0" id="DataTables_Table_0_next">下一页</a>
							<a class="paginate_button last" aria-controls="DataTables_Table_0"
								onclick="return pageFormSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.totalPage}','pageSize','${requestScope.pageInfoUtil.pageSize}')"
								data-dt-idx="5" tabindex="0" id="DataTables_Table_0_last">尾页</a>
							<span>
								每<input class="paginate_button" type="text" id="currentPage" name="currentPage" value="${requestScope.pageInfoUtil.currentPage}" size="5" maxlength="10">页
								每页<input class="paginate_button" type="text" id="pageSize" name="pageSize" value="${requestScope.pageInfoUtil.pageSize}" size="5" maxlength="10">条
								<input class="paginate_button" type="submit" value="GO">
							</span>
						</div>
					</form>
				</div>
			</div>
		</div>
		<%@ include file="/common/include/footer.jsp"%>
	
		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript"
			src="${rootPath }/common/resource/H-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
		<script type="text/javascript"
			src="${rootPath }/common/resource/H-ui.admin/lib/datatables/1.10.15/jquery.dataTables.min.js"></script>
		<script type="text/javascript" src="${rootPath }/common/resource/H-ui.admin/lib/laypage/1.2/laypage.js"></script>
		<script type="text/javascript">
			/*资讯-添加*/
			function article_add(title, url, w, h) {
				var index = layer.open({
					type : 2,
					title : title,
					content : url
				});
				layer.full(index);
			}
			/*资讯-编辑*/
			function article_edit(title, url, id, w, h) {
				var index = layer.open({
					type : 2,
					title : title,
					content : url
				});
				layer.full(index);
			}
			/*资讯-删除*/
			function article_del(obj, id) {
				layer.confirm('确认要删除吗？', function(index) {
					$.ajax({
						type : 'POST',
						url : '',
						dataType : 'json',
						success : function(data) {
							$(obj).parents("tr").remove();
							layer.msg('已删除!', {
								icon : 1,
								time : 1000
							});
						},
						error : function(data) {
							console.log(data.msg);
						},
					});
				});
			}
		</script>
	</body>
</html>